import QtQuick 2.0

Rectangle{
    id:root
    //声明自定义信号
    signal activated(real xPosition,real yPosition)
    signal deactivated
    width: 100
    height: 100
    color: 'red'
    MouseArea{
        anchors.fill: parent
        //鼠标经过和离开，调用信号
        onPressed: root.activated(mouse.x,mouse.y)
        onReleased: root.deactivated()
    }
}
